#ifndef NET_CONNECTION_HPP
#define NET_CONNECTION_HPP

#include <SFML/Network.hpp>
#include <Vector>

using namespace std;

class Net_Connection
{
public:
    void connect(sf::IPAddress& Ip, sf::Uint16& port);
    void disconnect();

    void move(float x, float y);
    void rotate(float angle);

    void receive();

    sf::Socket::Status SockSend(sf::Packet& Packet);
    sf::Socket::Status SockRecv(sf::Packet& Packet);

    sf::Int32 GetPid();
    sf::Vector2f GetPosition();
    float GetRotation();
    vector<class ClientPlayer> GetClients();
private:
    sf::SocketUDP Sock;
    sf::IPAddress Ip;
    sf::Uint16 Port;
    sf::Int32 pid;
    sf::Vector2f pos;
    float angle;

    vector<class ClientPlayer> clients;

    void RemoveFromVector(sf::Int32 pid);
    ClientPlayer& GetClientPlayerByPid(sf::Int32 pid);
};

#endif
